﻿/*
~ Monsieur Toast ~
~ or: How I Witnessed Some Rather Strange Happenings at the Diner. (Author's Note: No, not at Winkie's.) ~

Copyright (C) 2010 Thorsten Hochreuter

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

package {	
	
	//Contextmenu imports
	import flash.events.*;
	import flash.net.*;
	import flash.ui.*;
	import net.jmp0.toast.levels.MainMenu;
	
	//FP stuff
	import net.jmp0.toast.levels.GameLevel;
	import punk.core.*;
	import punk.util.*;
	import punk.*;

	[SWF(width = "640", height = "480")]
	
	public class Main extends Engine
	{
		public function Main()
		{
			//showSplash(0xFFFFFF, 0xFEBB53, .5, false);
			super(640, 480, 60, 1, MainMenu);
			
			customMenu();
			
		}
		
		private function customMenu():void {
			var myContextMenu:ContextMenu = new ContextMenu();
			
			var gameCredit:ContextMenuItem = new ContextMenuItem("game by jmp0.net");
			var fpCredit:ContextMenuItem = new ContextMenuItem("Flashpunkpowered since 0.85 - visit flashpunkt.net");
			var srcCredit:ContextMenuItem = new ContextMenuItem("Source Code available @ google code repository");

			gameCredit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, openJMPZERO);
			fpCredit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, openFP);
			srcCredit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, openSRC);
			srcCredit.separatorBefore = true;
			
			myContextMenu.hideBuiltInItems();
			myContextMenu.customItems.push(gameCredit, fpCredit, srcCredit);
			
			this.contextMenu = myContextMenu;
			
			function openJMPZERO(e:Event):void{
				var link:URLRequest = new URLRequest("http://www.jmp0.net/");
				navigateToURL(link, "_new" );
			}
			
			function openFP(e:Event):void{
				var link:URLRequest = new URLRequest("http://www.flashpunk.net/");
				navigateToURL(link, "_new" );
			}
		
			function openSRC(e:Event):void {
				var link:URLRequest = new URLRequest("http://code.google.com/p/monsieurtoast/");
				navigateToURL(link, "_new" );
			}
			
		}
	}
}